FROM golang as build

ENV GOPROXY=https://goproxy.io

ADD . /monitoring-api

WORKDIR /monitoring-api

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o monitoring_api

FROM alpine:3.7

#RUN echo "http://mirrors.aliyun.com/alpine/v3.7/main/" > /etc/apk/repositories && \
#    apk update && \
#    apk add ca-certificates && \
#    echo "hosts: files dns" > /etc/nsswitch.conf && \
#
#WORKDIR /www

COPY --from=build /monitoring-api/monitoring_api /usr/bin/monitoring_api

RUN chmod +x /usr/bin/monitoring_api

ENTRYPOINT ["monitoring_api"]

##docker build -t monitoring-api:v1 .
##docker run --name monitor_system -p 6789:6789 -d monitoring-api:v1
